<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/shop/style/style.css">
<script type="text/ecmascript" src="__PUBLIC__/shop/js/jquery-1.8.1.js"></script>
<script type="text/ecmascript" src="__PUBLIC__/shop/js/alert.js"></script>
<title>银行卡充值</title>
</head>

<body>
<div class="box">
<!-- <div class="top">
    <a href="pay.html"><p class="dayu"><img src="__PUBLIC__/shop/image/1.jpg"></p></a>
    <p class="biaoti"><span class="span2">付款详情</span></p>
</div> --><!--top-->
<div class="clear"></div>
<div class="recharge">
<div class="div1"><span class="span1">付款方式</span>
<span class="span2"><{$bankname}></span>
</div><!--div1-->
<div class="div2 money"><{$amount}></div>
<div class="div3"><span class="span1"><input type="number" placeholder="手机验证码" class="phone"></span><a href="javascript:void(0)"><span class="span2 sms">获取验证码</span></a></div>
<a href="javascript:void(0)"><div class="div4 pays">支付</div></a>
<input type="hidden" value="<{$user_id}>" name="user_id" id="user_id"/>
<input type="hidden" value="<{$openid}>" name="openid" />
</div><!--recharge-->
</div><!--box-->
<script type="text/javascript">
	$('.sms').click(function(){
		var user_id=$('.user_id').val();
		var openid=$("input[name=openid]").val();
		var amount=$('.money').html();
		$.post("<{:U('Pay/getmessage')}>",{user_id:user_id,openid:openid,amount:amount},function(data){
			if(data.status='01'){
				alert('发送成功');
			}else{
				alert('发送失败');
			}
		},'json');
	});
	$('.pays').click(function(){
		var user_id=$('#user_id').val();
		var openid=$("input[name=openid]").val();
		var amount=$('.money').html();
		var verifyCode=$('.phone').val();
		$.post("<{:U('Pay/submit')}>",{user_id:user_id,openid:openid,amount:amount,verifyCode:verifyCode},function(data){
			if(data.status==1){
				alert(data.msg);
				window.location.href='__APP__/Home/Index/get_weixin_shop/user_id/'+user_id;
			}else if(data.status=3){
				alert(data.msg);
				window.location.href='__APP__/Home/Index/get_weixin_shop/user_id/'+user_id;
			}else{
				alert('支付失败');
			}
		},'json');
	});
</script>
</body>
</html>
